//代码题一
let promise = new Promise(function(resolve,reject){
  setTimeout(() => {
    var a = 'hello'
    resolve(a)
  }, 10);
})
promise.then((a)=>{
  return new Promise((resolve,reject)=>{
    setTimeout(() => {
      var b = ' lagou'
      resolve(a+b)
    }, 10);
  })
}).then((b)=>{
  setTimeout(() => {
    var c = ' I♥U'
    console.log(b+c)
  }, 10);
},(err)=>{
  console.log(err)
})


//方式二
let promise1 = new Promise(function(resolve,reject){
  setTimeout(() => {
    var a = 'hello'
    resolve(a)
  }, 10);
})
let promise2 = new Promise(function(resolve,reject){
  setTimeout(() => {
    var b = ' lagou'
    resolve(b)
  }, 10);
})
let promise3 = new Promise(function(resolve,reject){
  setTimeout(() => {
    var c = ' I♥U'
    resolve(c)
  }, 10);
})
Promise.all([promise1,promise2,promise3]).then(result=>{
  console.log(result[0]+result[1]+result[2])
})